package com.qingke.pms.factory;

import com.qingke.pms.command.Command;
import com.qingke.pms.pojo.Project;
import com.qingke.pms.pojo.User;

public abstract class CommandFactory {
	public static enum CommandCode{
		//system
		LOGIN,
		REGISTER,
		HELP,
		EXIT,
		//user
		ADDCOMPANY,
		ADDMATERIAL,
		ADDPROJECT,
		ADDPROJECTLEADER,
		ALTERMATERIAL,
		ALTERPROJECT,
		ALTERUSER,
		APPROVE,
		LISTMATERIALS,
		LISTPROJECTS,
		LISTUSERS,
		INTO,
		//project

		
	}
	public static CommandFactory getFactory(User user,Project project){
		if(user!=null&&project!=null)
			return new ProjectCommandFactory(user,project);
		if(user!=null){
			return new UserCommandFactory(user);
		}
		return new SystemCommandFactory();
	}
	public abstract Command buildCommand(CommandCode cmdCode);
}
